#include<iostream>
#include<cctype>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define N 110000
#define inf 1e9+7
#define mo 1000000
#define ll long long
using namespace std;
inline int read()
{
    int x=0,flag=1;
    char ch=0;
    while(!isdigit(ch)){ch=getchar();if(ch=='-')flag=-1;}
    while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*flag;
}
int n,m,root,size,w[N],v[N],sz[N],fa[N],cnt[N],flag[N],son[N][2];
struct Splay
{
	inline void pushup(int x)
	{
		sz[x]=sz[son[x][0]]+sz[son[x][1]]+cnt[x];
	}
	inline void pushdown(int x)
	{
		if(flag[x])
		{
			swap(son[x][0],son[x][1]);
			flag[son[x][0]]^=1;
			flag[son[x][1]]^=1;
			flag[x]=0;
		}
	}
	inline bool getson(int x)
	{
		return son[fa[x]][1]==x;
	}
	inline void rotate(int x)
	{
		int y=fa[x],z=fa[y],tx=getson(x),ty=getson(y),p=son[x][!tx];
		fa[x]=z;son[z][ty]=x;
		fa[y]=x;son[x][!tx]=y;
		fa[p]=y;son[y][tx]=p;
		pushup(y);pushup(x);
	}
	inline void splay(int x,int goal)
	{
		while(fa[x]!=goal)
		{
			int y=fa[x],z=fa[y];
			if(z==goal)
			{
				rotate(x);
				break;
			}
			if(getson(x)==getson(y))
			{
				rotate(y);
				rotate(x);
			}
			else
			{
				rotate(x);
				rotate(x);
			}
		}
		if(!goal)root=x;
	}
	inline int rank(int x)
	{
		int id=root;
		if(sz[id]<x)return false;
		while(true)
		{
			pushdown(id);
			if(x>sz[son[id][0]]+cnt[id])
			x-=sz[son[id][0]]+cnt[id],id=son[id][1];
			else
			{
				if(x<=sz[son[id][0]])
				id=son[id][0];
				else
				return id;
			}
		}
	}
	inline void insert(int x)
	{
		int id=root,ff=0;
		while(x!=w[id]&&id)
		{
			ff=id;
			id=son[id][x>w[id]];
		}
		if(id)
		cnt[id]++;
		else
		{
			id=++size;
			w[id]=x;
			fa[id]=ff;
			sz[id]=cnt[id]=1;
			son[ff][x>w[ff]]=id;
		}
		splay(id,0);
	}
	void print(int x)
	{
		if(!x)return;
		pushdown(x);
		print(son[x][0]);
		if(1<=w[x]&&w[x]<=n)
		printf("%d ",w[x]);
		print(son[x][1]);
	}
}S;
int main()
{
	int i,l,r,x,y;
	n=read();
	m=read();
	S.insert(n+1);
	S.insert(0);
	for(i=1;i<=n;i++)
	S.insert(i);
	for(i=1;i<=m;i++)
	{
		l=read();
		r=read();
		x=S.rank(l);
		y=S.rank(r+2);
		S.splay(x,0);
		S.splay(y,x);
		flag[son[y][0]]^=1;
	}
	S.print(root);
	return 0;
}

